package me.shurufa.activities;

import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import me.shurufa.R;
import me.shurufa.widget.popupwindow.WheelPopWindow;

/**
 * 保存为书摘后跳转
 *
 * @FileName: me.shurufa.activities.BookConfigActivity.java
 * @author: kHRYSTAL
 * @email: 723526676@qq.com
 * @date: 2016-01-20 12:32
 */
public class BookConfigActivity extends BaseActivity implements View.OnClickListener, WheelPopWindow.OnCompleteClickListener {
    @Bind(R.id.testButton)
    Button testButton;

    WheelPopWindow popWindow;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        activity_layout_res = R.layout.activity_book_config;
        super.onCreate(savedInstanceState);
        initData();
        initUI();
    }

    private void initData() {
        List<String> data = new ArrayList<>();
        for (int i = 0; i < 100; i++) {
            data.add(""+i);
        }
        //popWindow = new WheelPopWindow(this,data);
        popWindow.setOnCompleteClickListener(this);
    }

    private void initUI() {
        testButton.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.testButton:
                popWindow.init();
                popWindow.showPickerWindow(v, 100);
                break;
        }

    }

    /**
     * popWindow 点击完成按钮事件
     */
    @Override
    public void onCompleteClicked() {
        if (popWindow!=null){
            //Toast.makeText(this,popWindow.getCurrentData(),Toast.LENGTH_SHORT).show();
            popWindow.dismiss();
        }
    }
}
